package com.xxtx.trade.web.fieldManage;

import com.xxtx.trade.agent.dto.ImeiToPhoneDto;
import com.xxtx.trade.common.util.model.Result;
import com.xxtx.trade.fieldManage.dto.FieldManageDto;
import com.xxtx.trade.fieldManage.mapper.FieldManageMapper;
import com.xxtx.trade.fieldManage.service.FieldManageService;
import com.xxtx.trade.sysUser.dto.PhoneOwnershipDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;

@RestController
@RequestMapping("/api/v1/xxtx/fieldManage")
public class FieldManageController {

    @Autowired
    private FieldManageService fieldManageService;

    @RequestMapping(value = "/changeStatus", method = RequestMethod.PUT)
    public Result changeStatus(@RequestBody FieldManageDto fieldManageDto) {
        return fieldManageService.changeStatus(fieldManageDto);
    }

    @RequestMapping(value = "/getFieldList", method = RequestMethod.GET)
    public Result getFieldList() {
        return fieldManageService.getList();
    }

    @RequestMapping(value = "/setImeiPhone", method = RequestMethod.PUT)
    public Result setImeiPhone(@RequestBody ImeiToPhoneDto imeiToPhoneDto){
        return fieldManageService.setImeiPhone(imeiToPhoneDto);
    }

//    @RequestMapping(value = "/setPhoneOwnership", method = RequestMethod.POST)
//    public Result setPhoneOwnership(@RequestBody PhoneOwnershipDto phoneOwnership){
//        // 用以插入号码归属地
//        Result result = fieldManageService.setPhoneOwnership(phoneOwnership);
//        return result;
//    }

//    @RequestMapping(value = "/phoneOwnershipToRedis", method = RequestMethod.GET)
//    public void phoneOwnershipToRedis(){
//        // 该方法用于将号码归属地信息存到redis中
//        fieldManageService.phoneOwnershipToRedis();
//    }

}
